/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.base.entity.supplier;

import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.sys.entity.Area;
import com.jeesite.modules.sys.entity.User;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * 供应商Entity
 * @author LV
 * @version 2021-03-01
 */
@Table(name="t_supplier", alias="a", columns={
		@Column(name="supplier_id", attrName="supplierId", label="供应商编号", isPK=true, queryType=QueryType.LIKE),
		@Column(name="supplier_name", attrName="supplierName", label="供应商名称", queryType=QueryType.LIKE),
		@Column(name="supplier_type", attrName="supplierType", label="供应商类型"),
		@Column(name="supplier_name_abbreviation", attrName="supplierNameAbbreviation", label="供应商名称缩写", queryType=QueryType.EQ),
		@Column(name="remarks", attrName="remarks", label="备注", isQuery=false),
		@Column(name="business_type", attrName="businessType", label="业务类型", isQuery=false),
        @Column(name="area", attrName="area.areaCode", label="区域", isQuery=false),
		@Column(name="port", attrName="port", label="港口", queryType=QueryType.EQ),
		@Column(name="address", attrName="address", label="详细地址", isQuery=false),
		@Column(name="income_bank_info", attrName="incomeBankInfo", label="收益行信息", isQuery=false),
		@Column(name="credit_account_name", attrName="creditAccountName", label="名称", isQuery=false),
		@Column(name="credit_account_address", attrName="creditAccountAddress", label="地址", isQuery=false),
		@Column(name="swift_number", attrName="swiftNumber", label="swift码", isQuery=false),
		@Column(name="tt_account_name", attrName="ttAccountName", label="户名", isQuery=false),
		@Column(name="tt_account_number", attrName="ttAccountNumber", label="账号", isQuery=false),
		@Column(name="tt_bank_name", attrName="ttBankName", label="银行名称", isQuery=false),
		@Column(name="tt_bank_address", attrName="ttBankAddress", label="银行地址", isQuery=false),
		@Column(name="interest_calculation_method", attrName="interestCalculationMethod", label="计息方式", isQuery=false),
		@Column(name="fax", attrName="fax", label="传真", isQuery=false),
		@Column(name="phone", attrName="phone", label="电话", isQuery=false),
		@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false),
	},joinTable = {
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Area.class, alias = "b",
                on = "b.area_code = a.area",
                columns = {
                        @Column(name = "area_code", label = "区域代码", isPK = true),
                        @Column(name = "area_name", label = "区域名称", isQuery = false),
                        @Column(name = "area_type", label = "区域类型"),
                        @Column(name = "tree_names", label = "区域全称"),
                }),
		@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = User.class, attrName = "createByUser", alias = "createby",
				on = "createby.user_code = a.create_by", columns = {
				@Column(name = "user_code", label = "用户编码", isPK = true),
				@Column(name = "user_name", label = "用户名称", isQuery = false),
		}),
		@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = User.class, attrName = "updateByUser", alias = "updateby",
				on = "updateby.user_code = a.update_by", columns = {
				@Column(name = "user_code", label = "用户编码", isPK = true),
				@Column(name = "user_name", label = "用户名称", isQuery = false),
		}),
    },orderBy="a.update_date DESC"
)
public class Supplier extends DataEntity<Supplier> {
	
	private static final long serialVersionUID = 1L;
	private String supplierId;		// 供应商编号
	private String supplierName;		// 供应商名称
	private String supplierType;		// 供应商类型
	private String supplierNameAbbreviation;		// 供应商名称缩写
	private Area area;		// 区域
	private String port;		// 港口
	private String address;		// 详细地址
	private String incomeBankInfo;		// 收益行信息
	private String creditAccountName;		// 名称
	private String creditAccountAddress;		// 地址
	private String swiftNumber;		// swift码
	private String ttAccountName;		// 户名
	private String ttAccountNumber;		// 账号
	private String ttBankName;		// 银行名称
	private String ttBankAddress;		// 银行地址
	private String interestCalculationMethod;		// 计息方式
	private String fax;		// 传真
	private String phone;		// 电话
	private String businessType;		// 业务类型
	private List<SupplierBusinessInfo> supplierBusinessInfoList = ListUtils.newArrayList();		// 子表列表
//	private List<SupplierBusinessType> supplierBusinessTypeList = ListUtils.newArrayList();		// 子表列表
	private List<SupplierContactInfo> supplierContactInfoList = ListUtils.newArrayList();		// 子表列表
	private List<SupplierCustomBroker> supplierCustomBrokerList = ListUtils.newArrayList();		// 子表列表
	private User createByUser;
	private User updateByUser;


	public Supplier() {
		this(null);
	}

	public Supplier(String id){
		super(id);
	}
	
	public String getSupplierId() {
		return supplierId;
	}

	public void setSupplierId(String supplierId) {
		this.supplierId = supplierId;
	}
	
	@NotBlank(message="供应商名称不能为空")
	@Length(min=0, max=100, message="供应商名称长度不能超过 100 个字符")
	public String getSupplierName() {
		return supplierName;
	}

	public void setSupplierName(String supplierName) {
		this.supplierName = supplierName;
	}
	
	@NotBlank(message="供应商类型不能为空")
	@Length(min=0, max=2, message="供应商类型长度不能超过 2 个字符")
	public String getSupplierType() {
		return supplierType;
	}

	public void setSupplierType(String supplierType) {
		this.supplierType = supplierType;
	}
	
	@NotBlank(message="供应商名称缩写不能为空")
	@Length(min=0, max=100, message="供应商名称缩写长度不能超过 100 个字符")
	public String getSupplierNameAbbreviation() {
		return supplierNameAbbreviation;
	}

	public void setSupplierNameAbbreviation(String supplierNameAbbreviation) {
		this.supplierNameAbbreviation = supplierNameAbbreviation;
	}

	@Length(min=0, max=64, message="港口长度不能超过 64 个字符")
	public String getPort() {
		return port;
	}

	public void setPort(String port) {
		this.port = port;
	}
	
	@NotBlank(message="详细地址不能为空")
	@Length(min=0, max=200, message="详细地址长度不能超过 200 个字符")
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	@Length(min=0, max=100, message="收益行信息长度不能超过 100 个字符")
	public String getIncomeBankInfo() {
		return incomeBankInfo;
	}

	public void setIncomeBankInfo(String incomeBankInfo) {
		this.incomeBankInfo = incomeBankInfo;
	}
	
	@Length(min=0, max=100, message="名称长度不能超过 100 个字符")
	public String getCreditAccountName() {
		return creditAccountName;
	}

	public void setCreditAccountName(String creditAccountName) {
		this.creditAccountName = creditAccountName;
	}
	
	@Length(min=0, max=200, message="地址长度不能超过 200 个字符")
	public String getCreditAccountAddress() {
		return creditAccountAddress;
	}

	public void setCreditAccountAddress(String creditAccountAddress) {
		this.creditAccountAddress = creditAccountAddress;
	}
	
	@Length(min=0, max=100, message="swift码长度不能超过 100 个字符")
	public String getSwiftNumber() {
		return swiftNumber;
	}

	public void setSwiftNumber(String swiftNumber) {
		this.swiftNumber = swiftNumber;
	}
	
	@Length(min=0, max=100, message="户名长度不能超过 100 个字符")
	public String getTtAccountName() {
		return ttAccountName;
	}

	public void setTtAccountName(String ttAccountName) {
		this.ttAccountName = ttAccountName;
	}
	
	@Length(min=0, max=100, message="账号长度不能超过 100 个字符")
	public String getTtAccountNumber() {
		return ttAccountNumber;
	}

	public void setTtAccountNumber(String ttAccountNumber) {
		this.ttAccountNumber = ttAccountNumber;
	}
	
	@Length(min=0, max=100, message="银行名称长度不能超过 100 个字符")
	public String getTtBankName() {
		return ttBankName;
	}

	public void setTtBankName(String ttBankName) {
		this.ttBankName = ttBankName;
	}
	
	@Length(min=0, max=200, message="银行地址长度不能超过 200 个字符")
	public String getTtBankAddress() {
		return ttBankAddress;
	}

	public void setTtBankAddress(String ttBankAddress) {
		this.ttBankAddress = ttBankAddress;
	}
	
	@Length(min=0, max=2, message="计息方式长度不能超过 2 个字符")
	public String getInterestCalculationMethod() {
		return interestCalculationMethod;
	}

	public void setInterestCalculationMethod(String interestCalculationMethod) {
		this.interestCalculationMethod = interestCalculationMethod;
	}
	
	@Length(min=0, max=100, message="传真长度不能超过 100 个字符")
	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}
	
	public List<SupplierBusinessInfo> getSupplierBusinessInfoList() {
		return supplierBusinessInfoList;
	}

	public void setSupplierBusinessInfoList(List<SupplierBusinessInfo> supplierBusinessInfoList) {
		this.supplierBusinessInfoList = supplierBusinessInfoList;
	}

	public List<SupplierContactInfo> getSupplierContactInfoList() {
		return supplierContactInfoList;
	}

	public void setSupplierContactInfoList(List<SupplierContactInfo> supplierContactInfoList) {
		this.supplierContactInfoList = supplierContactInfoList;
	}
	
	public List<SupplierCustomBroker> getSupplierCustomBrokerList() {
		return supplierCustomBrokerList;
	}

	public void setSupplierCustomBrokerList(List<SupplierCustomBroker> supplierCustomBrokerList) {
		this.supplierCustomBrokerList = supplierCustomBrokerList;
	}

    public Area getArea() {
        return area;
    }

    public void setArea(Area area) {
        this.area = area;
    }

    public String getBusinessType() {
        return businessType;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

	public User getCreateByUser() {
		return createByUser;
	}

	public void setCreateByUser(User createByUser) {
		this.createByUser = createByUser;
	}

	public User getUpdateByUser() {
		return updateByUser;
	}

	public void setUpdateByUser(User updateByUser) {
		this.updateByUser = updateByUser;
	}
}